import { apiClient } from './apiClient';

// 分析API服务
export const analysisApi = {
  // 系统统计
  getSystemStatistics() {
    return apiClient.get('/api/analysis/system-statistics');
  },
  
  // 热门城市
  getHotCityStatistics() {
    return apiClient.get('/api/analysis/hot-cities');
  },
  
  // 城市统计
  getCityStatistics(city) {
    return apiClient.get(`/api/analysis/city-statistics?city=${encodeURIComponent(city)}`);
  },
  
  // 价格分布
  getPriceDistribution(city) {
    return apiClient.get(`/api/analysis/price-distribution?city=${encodeURIComponent(city)}`);
  },
  
  // 面积分布
  getAreaDistribution(city) {
    return apiClient.get(`/api/analysis/area-distribution?city=${encodeURIComponent(city)}`);
  },
  
  // 户型分布
  getLayoutDistribution(city) {
    return apiClient.get(`/api/analysis/layout-distribution?city=${encodeURIComponent(city)}`);
  },
  
  // 装修分布
  getDecorationDistribution(city) {
    return apiClient.get(`/api/analysis/decoration-distribution?city=${encodeURIComponent(city)}`);
  },
  
  // 价格-面积散点图
  getPriceAreaScatter(city) {
    return apiClient.get(`/api/analysis/price-area-scatter?city=${encodeURIComponent(city)}`);
  },
  
  // 价格趋势
  getPriceTrends(city) {
    return apiClient.get(`/api/analysis/price-trends?city=${encodeURIComponent(city)}`);
  },
  
  // 区域分析
  getDistrictAnalysis(city) {
    return apiClient.get(`/api/analysis/district-analysis?city=${encodeURIComponent(city)}`);
  },
  
  // 区域详情
  getDistrictDetail(city, district) {
    return apiClient.get(`/api/analysis/district-detail?city=${encodeURIComponent(city)}&district=${encodeURIComponent(district)}`);
  },
  
  // 城市对比
  getCityComparison(cities) {
    return apiClient.post('/api/analysis/city-comparison', { cities });
  },
  
  // 房源价格分析
  getHousePriceAnalysis(id) {
    return apiClient.get(`/api/analysis/house-price-analysis/${id}`);
  },
  
  // 缓存管理
  clearCache(prefix) {
    return apiClient.delete(`/api/cache/clear?prefix=${encodeURIComponent(prefix)}`);
  },
  
  clearAllAnalysisCache() {
    return apiClient.delete('/api/cache/clear-all-analysis');
  },
  
  getCacheStats() {
    return apiClient.get('/api/cache/stats');
  }
}; 